<?php 
$conId = 'goodslist';
$stock = Yii::$app->request->get('stock');

?>
<?php $this->beginBlock('css');?>
<link rel="stylesheet" type="text/css" href="<?=Yii::getAlias('@static')?>/pc/common/css/common.css">
<link rel="stylesheet" type="text/css" href="<?=Yii::getAlias('@static')?>/pc/liketry/css/goods.css">
<link rel="stylesheet" type="text/css" id="lktStyle">
<?php $this->endBlock();?>
<?php $this->beginBlock('headjs');?>
<script>
(function(){
	var lktStyle = function(){
		document.getElementById("lktStyle").setAttribute("href", document.documentElement.clientWidth>=1200?"":"<?=Yii::getAlias('@static')?>/pc/liketry/css/small.css")
	}
	window.onresize = lktStyle;
	lktStyle();
})();
</script>
<?php $this->endBlock();?>
<?= $this->render('@liketry/views/layouts/header_goods.php',['top_ad_show'=>false])?>
<!-- 顶部拉幕广告&&搜索框 Start -->
<div class="header"></div>
<!-- 顶部拉幕广告&&搜索框 End -->

<!-- 主体内容 Start -->
<div class="main">
<form id="goodsList" action="<?=Yii::$app->urlManager->createUrl(["$conId/search"]);?>">
	<input type="hidden" name="r" value="goodslist/search">
	<input type="hidden" name="goods_name" id="goods_name" value="<?php echo !empty($_GET['goods_name'])?$_GET['goods_name']:'';?>">
	<div class="list-breadNav">
		<a class="home" href="<?=\Yii::$app->urlManager->createUrl(['index'])?>"><i class="icon icon-home"></i>首页<em class="arrow">&gt;</em></a>
		<a >
		<?php 
		$category = Yii::$app->request->get ( 'category', '' );
		if(!empty($category) && $category == 1):?>
			焕新颜
		<?php elseif(!empty($category) && $category == 2):?>
			尝美味
		<?php elseif(!empty($category) && $category == 3):?>
			黑科技
		<?php elseif(!empty($category) && $category == 4):?>
			寻尖货
		<?php elseif(!empty($category) && $category == 5):?>
			趣好店
		<?php elseif(!empty($category) && $category == 6):?>
			爱北鼻
		<?php else:?>
			全部
		<?php endif;?><em class="arrow">&gt;</em></a>
		
		<p class="choose" id="searchTags">
		</p>
		<a  class="del-all del-btn" href="<?=Yii::$app->urlManager->createUrl(["$conId/lists"]);?>">清空筛选</a>
	</div>
	<div class="list-select" id="listSelect">
		<ul>
			<!--- 品牌 Start -->
			<li class="brand">
				<div class="ls-key">品牌</div>
				<div class="ls-valude close">
					<!--- 字母 Start -->
					<div class="letter-list">
						<a class="unlimited cur" data-id=""><span>不限</span></a>
						<?php 
						if (!empty($q_index)):
						foreach ($q_index as $qk=>$qv):?>
						<a data-id="<?php echo $qv?>"><span><?php echo $qv;?></span></a>
						<?php 
						endforeach;
                        endif;?>
					</div>
					<!--- 字母 End -->
					<div class="brand-list select">
						<a data-id="-1" class="unlimited cur"><span>不限</span></a>
						<?php echo $brands;?>
					</div>
					<div class="show-more"><em>展开</em><i class="arrow icon icon-arrow-down"></i></div>
				</div>
				<div class="clear"></div>
				<input type="hidden" name="brand_id" id="brandId" value="<?php echo !empty($_GET['brand_id'])?$_GET['brand_id']:''?>"/>
				<input type="hidden" name="brand_name" id="brandName" value="<?php echo !empty($_GET['brand_name'])?$_GET['brand_name']:''?>" />
				
			</li>
			<!--- 品牌 End -->

			<!--- 价格 Start -->
			<li class="price">
				<div class="ls-key">价格</div>
				<div class="ls-valude select">
					<a data-id="0" class="unlimited cur"><span>不限</span></a>
					<a data-id="1" data-m="0" data-l="99"><span>0-99元</span></a>
					<a data-id="2" data-m="100" data-l="299"><span>100-299元</span></a>
					<a data-id="3" data-m="300" data-l="500"><span>300-500元</span></a>
					<a data-id="4" data-m="500"><span>500+</span></a>
				</div>
				<div class="clear"></div>
				<input type="hidden" name="price_start" id="priceStart" value="<?php echo !empty($_GET['price_start'])?$_GET['price_start']:''?>"/>
				<input type="hidden" name="price_end" id="priceEnd" value="<?php echo !empty($_GET['price_end'])?$_GET['price_end']:''?>" />
				<input type="hidden" name="price_id" id="priceId" value="<?php echo !empty($_GET['price_id'])?$_GET['price_id']:''?>" />
			</li>
			<!--- 价格 End -->

			<!--- 试豆 Start -->
			<li class="try_price">
				<div class="ls-key">试豆</div>
				<div class="ls-valude select">
					<a data-id="0" class="unlimited cur"><span>不限</span></a>
					<a data-id="1" data-m="0" data-l="499"><span>0-499</span></a>
					<a data-id="2" data-m="500" data-l="999"><span>500-999</span></a>
					<a data-id="3" data-m="1000" data-l="1999"><span>1000-1999</span></a>
					<a data-id="4" data-m="2000"><span>2000+</span></a>
				</div>
				<div class="clear"></div>
				<input type="hidden" name="try_price_start" id="tryPriceStart" value="<?php echo !empty($_GET['try_price_start'])?$_GET['try_price_start']:''?>"/>
				<input type="hidden" name="try_price_end" id="tryPriceEnd" value="<?php echo !empty($_GET['try_price_end'])?$_GET['try_price_end']:''?>"/>
				<input type="hidden" name="try_price_id" id="tryPriceId" value="<?php echo !empty($_GET['try_price_id'])?$_GET['try_price_id']:''?>" />
			</li>
			<!--- 试豆 End -->

			<!--- 类型 Start -->
			<li class="type">
				<div class="ls-key">类型</div>
				<div class="ls-valude select">
					<a data-id="0" class="unlimited cur"><span>不限</span></a>
					<a data-id="1"><span>购买</span></a>
					<a data-id="2"><span>试用</span></a>
					<a data-id="3"><span>购买 + 试用</span></a>
				</div>
				<div class="clear"></div>
				<input type="hidden" name="type" id="type"  value="<?php echo !empty($_GET['type'])?$_GET['type']:''?>"/>
			</li>
			<!--- 类型 End -->

			
		</ul>
	</div>
	<div class="list-sort" id="listSort">
		<span class="sortbtn sortbtn1 desc hot" data-id="1">热销<i class="icon icon-arrow-desc-white"></i></span>
		<span class="sortbtn sortbtn2 price" data-id="2">价格<i class="icon icon-arrow-desc-grey"></i></span>
		<!-- 
		<span class="sortbtn try" data-id="3">试豆<i class="icon icon-arrow-desc-grey"></i></span>
		 -->
		<span class="sortbtn sortbtn4 new" data-id="4">最新<i class="icon icon-arrow-desc-grey"></i></span>
		<span class="stock <?php if($stock == '1') :?>stock-select<?php endif;?>" id="isHasGoods"><i class="icon icon-stock <?php if($stock == '1') :?>icon-stock-selected<?php endif;?>"></i>仅显示有货</span>
		<input type="hidden" name="sort_type" value="<?php echo !empty($_GET['sort_type'])?$_GET['sort_type']:''?>">
		<input type="hidden" name="sort" value="<?php echo !empty($_GET['sort'])?$_GET['sort']:''?>">
		<input type="hidden" name="stock" value="<?php echo !empty($_GET['stock'])?$_GET['stock']:''?>">
		<input type="hidden" name="category" id="category" value="<?php echo !empty($_GET['category'])?$_GET['category']:''?>"/>
	</div>

	<!-- 商品列表 Start -->
	<div class="list-goods">
		<ul>
		    <?php if(!empty($list_info['text'])) :
		        echo $list_info['text'];
		    else:
		        echo '<p class="none">没有符合搜索条件的商品</p>';
		    endif;?>
		</ul>
	</div>
	<div class="page-wrap">
		<?= $list_info['page']; ?>
	</div>
	<!-- 商品列表 End -->
</form>
</div>
<!-- 主体内容 End -->

<!--侧边栏-->
<?= $this->render('@liketry/views/layouts/sidebar.php')?>

<?php $this->beginBlock('js');?>
<script src="<?=Yii::getAlias('@static')?>/pc/common/js/jquery-1.12.3.min.js"></script>
<script src="<?=Yii::getAlias('@static')?>/pc/common/js/lkt.pc.js"></script>
<script src="<?= Yii::getAlias('@static')?>/pc/common/js/jquery.lazyload.min.js"></script>
<script src="<?=Yii::getAlias('@static')?>/pc/liketry/js/goods.js"></script>
<script type="text/javascript">
	var requestListUrl = "<?=Yii::$app->urlManager->createUrl(["$conId/getlists"]);?>&page=<?php echo $page?>";
	var requestBrandUrl= "<?=Yii::$app->urlManager->createUrl(["$conId/getbrandsbytype"]);?>";
	var sort_type = "<?php echo !empty($_GET['sort_type'])?$_GET['sort_type']:''?>";
	var sort = "<?php echo !empty($_GET['sort'])?$_GET['sort']:''?>";
	var stock = "<?php echo !empty($_GET['stock'])?$_GET['stock']:''?>";
	var searchData = {
		"brand":"<?php echo !empty($_GET['brand_id'])?$_GET['brand_id']:''?>",
		"price":"<?php echo !empty($_GET['price_id'])?$_GET['price_id']:''?>",
		"try_price":"<?php echo !empty($_GET['try_price_id'])?$_GET['try_price_id']:''?>",
		"type":"<?php echo !empty($_GET['type'])?$_GET['type']:''?>"
	};
	var goodsName = "<?php echo !empty($_GET['goods_name'])?$_GET['goods_name']:'';?>";
</script>
<?php $this->endBlock();?>
